import Vue from 'vue'
import Vuex from 'vuex'
import cart from './cart'
import order from './order'
import contact from './contact'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  modules: {
    cart,
    order,
    contact
  },
  plugins: [createPersistedState()]
})

// export default new Vuex.Store({
//   modules: {
//     cart,
//     order,
//     contact
//   },
//   plugins: [createPersistedState({
//     storage: window.sessionStorage,
//     reducer: state => {
//       return {
//         // 指定缓存哪些数据
//         cart: state.cart
//       }
//     }
//   })]
// })
